home *** CD-ROM | disk | FTP | other *** search
/ CD World Haziran 1997 / CD World Haziran 1997.iso / Explorer Yardimcilari / PiXCL Tools / Boxes.px_ / Boxes.px
Encoding:
PiXCL source  |  1996-07-26  |  22.3 KB  |  759 lines

  1. {-------------- sample PiXCL source code ------------------------}
  2. { ---- can be freely copied in your programs --------------------}
  3.  
  4. Initialize:
  5.     WinGetActive(Win$)
  6.     UseCoordinates(PIXEL)
  7.     UseBackGround(TRANSPARENT,192,192,192)
  8.     DrawBackGround
  9.     WaitInput(100)  {let NT and 95 catch up}
  10.     InfoMenu(REMOVE)
  11.     SetMenu()
  12.     WinLocate(Win$,200,100,700,620,Res)
  13.     WinShow(Win$,NOTOPMOST,Res)
  14.     Title$ = "GDI Drawing and Frame Controls"
  15.     WinTitle(Win$, Title$)
  16.     DirGet(SourceDir$)
  17.     Flag = 0
  18.  
  19.  
  20.     SetMenu("Exit!",Leave,
  21.         ENDPOPUP,
  22.         "Test",IGNORE,
  23.         "Modulus",TestModulus,
  24.         "Random",RandNum,
  25.         ENDPOPUP,
  26.         "GDI Drawing",IGNORE,
  27.         "Fast Draw",FastDraw,
  28.         SEPARATOR,
  29.         "BoxesR",DrawBoxesR,
  30.         "BoxesP",DrawBoxesP,
  31.         "Ellipses",DrawEllipses,
  32.         "Triangles",DrawTriangles,
  33.         "Polygons",DrawPolygons,
  34.         "Stars",DrawStars,
  35.         "MapleLeaves 1",DrawMapleLeaf1,
  36.         "MapleLeaves 2",DrawMapleLeaf2,
  37.         "Images",DrawImages,
  38.         "Line Style 1",DrawLines,
  39.         "Line Style 2",DrawLines2,
  40.         "Bouncing Shapes",DrawBounce,
  41.         SEPARATOR,
  42.         "DrawCapt",Captions,
  43.         SEPARATOR,
  44.         "Mouse Draw ON",Mouse_DrawOn,
  45.         "MouseDraw OFF",Mouse_DrawOff,
  46.         "MemDC",ReDrawMemoryDC,
  47.         SEPARATOR,
  48.         "Choose Color",GetColor,
  49.         ENDPOPUP,
  50.         "Frame Controls",IGNORE,
  51.         "Button",Control_Button,
  52.         "Caption",Control_Caption,
  53.         "Menu",Control_Menu,
  54.         "Scroll",Control_Scroll,
  55.         "Show All",Control_All,
  56.         ENDPOPUP,
  57.         "Help",IGNORE,
  58.         "GDI Drawing",GDIDemoHelp,
  59.         "SetDrawMouse",DrawMouseHelp,
  60.         "View Source",ViewSource,
  61.         SEPARATOR,
  62.         "WinHelp",GetHelp,
  63.         "AboutPiXCL",About,
  64.         ENDPOPUP)
  65.         
  66.         StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
  67.         i = 0
  68.         FastDrawFlag = 0
  69.         UseBrush(SOLID,128,128,255)
  70.     
  71. Wait_for_Input:
  72.     WaitInput()
  73.  
  74.  
  75. Leave:
  76.     End
  77.  
  78. FastDraw:
  79.     If FastDrawFlag = 0
  80.         FastDrawFlag = 1
  81.        ChangeMenuItem("Fast Draw",CHECK,Res)
  82.        DrawStatusWinText(0,"Fast GDI Draw mode")
  83.     Else
  84.         FastDrawFlag = 0
  85.        ChangeMenuItem("Fast Draw",UNCHECK,Res)
  86.              DrawStatusWinText(0,"Slow GDI Draw mode")
  87.     Endif
  88.     Goto Wait_for_Input
  89.  
  90. GDIDemoHelp:
  91.     MessageBox(OK,1,INFORMATION,
  92. "The GDI drawing menu top item 'Fast Draw' sets a flag that 
  93. inserts a 64mS delay after each vector or polygon is drawn.
  94.  
  95. Clicking the left mouse in the client area will stop the
  96. draw operations, clear the screen and report the number
  97. of polygons or vectors drawn. You can also select any menu
  98. item. You will notice a delay in the menu item selecting:
  99. this is because the PiXCL script checks for input every
  100. 50 vectors. This delay can be changed in the PXL source 
  101. file if you want.
  102.  
  103. DrawPolygon and DrawTriangle operations are faster than
  104. DrawEllipse.",
  105.     "GDI Drawing Options",Res)
  106.  
  107.     Goto Wait_for_Input
  108.  
  109. DrawMouseHelp:
  110.     MessageBox(OK,1,INFORMATION,
  111. "If you start a GDI drawing operation - boxes, ellipses,
  112. polygons or lines - you can stop the draw process without
  113. clearing the background with the 'Mouse Draw On' command.
  114.  
  115. You can select any of the colors for drawing with the 
  116. mouse in the client area by using a Ctrl-Left Mouse click
  117. on a pixel of the desired color. Holding the left mouse
  118. button down will then draw in the selected color as you
  119. move. 
  120.  
  121. To clear the draw mouse, click the right mouse. This is
  122. not the default action, only how the sample program was
  123. written. You could just as easily use the ShiftRightMouse
  124. or a keyboard entry.",
  125.     "Set Draw Mouse Help",Res)
  126.  
  127.     Goto Wait_for_Input
  128.  
  129.  
  130. ViewSource:
  131.     PXL_file$ = SourceDir$ + "\boxes.pxl"
  132.     CmdLine$ = "Notepad " + PXL_file$
  133.     WinShow(Title$,NOTOPMOST,Res)
  134.     Run(CmdLine$)
  135.     Goto Wait_for_Input
  136.  
  137.  
  138. GetColor:
  139.     GetPixel(X,Y,R,G,B,Res)
  140.     UsePen(SOLID,3,R,G,B)
  141.     Goto Wait_for_Input
  142.  
  143. Mouse_DrawOn:
  144.     DrawStatusWinText(1,"Mouse Drawing enabled.")
  145.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  146.     SetCtrlMouse(cx1,cy1,cx2,cy2,DrawBlock,X,Y)
  147.     SetRightMouse(cx1,cy1,cx2,cy2,ReDrawMemoryDC,n,n)
  148.     SetCtrlMouse(cx1,cy1,cx2,cy2,GetColor,X,Y)
  149.     SetMouse()
  150.     SetDrawMouse(FOREGND)
  151.     DrawLine(10,10,100,10)
  152.     Goto Wait_for_Input
  153.  
  154.  
  155. Mouse_DrawOff:
  156.     DrawStatusWinText(1,"Mouse Drawing disabled.")
  157.     SetDrawMouse(DISABLE)
  158.     SetRightMouse()
  159.     Goto Wait_for_Input
  160.  
  161. ReDrawMemoryDC:
  162.     ReDraw
  163.     Goto Wait_for_Input
  164.  
  165. DrawBlock:
  166.     X1 = X - 15     X2 = X + 15
  167.     Y1 = Y - 15     Y2 = Y + 15
  168.     DrawRectangle(X1,Y1,X2,Y2)
  169.     Goto Wait_for_Input
  170.  
  171.  
  172.  
  173.  
  174.  
  175. About:
  176.     AboutPiXCL
  177.     AboutUser("PiXCL Tools Sample Program",
  178. "Windows GDI Draw, Frame Controls and WinHelp access.",
  179. "A variety of shapes can be drawn in fast mode or slow 
  180. mode which waits 64mS between each draw operation. 
  181. Click the left mouse in the client area to stop.
  182. Frame controls can be drawn any size or position.")
  183.     Goto Wait_for_Input
  184.  
  185. Control_Button:
  186.     DrawStatusWinText(1,"Frame controls built into PiXCL.")
  187.     DrawBackground
  188.     DrawFrameControl(0,0,40,40,BUTTONRADIO,INACTIVE,Res)
  189.     DrawFrameControl(50,0,90,40,BUTTONPUSH,INACTIVE,Res)
  190.     DrawFrameControl(100,0,140,40,BUTTON3STATE,INACTIVE,Res)
  191.     DrawFrameControl(150,0,190,40,BUTTONCHECK,INACTIVE,Res)
  192.         SetMouse(0,0,40,40,Ctl,X,Y)
  193.     SetRightMouse(0,0,40,40,Ctr,X,Y)
  194.     Goto Wait_for_Input
  195. Ctl:
  196.     DrawFrameControl(0,0,40,40,BUTTONRADIO,PUSHED,Res)
  197.  
  198.     Goto Wait_for_Input
  199. Ctr:
  200.     DrawFrameControl(0,0,40,40,BUTTONRADIO,CHECKED,Res)
  201.  
  202.     Goto Wait_for_Input
  203.  
  204. Control_Caption:
  205.     DrawStatusWinText(1,"Caption control built into PiXCL.")
  206.     DrawBackground
  207.     DrawFrameControl(0,0,40,40,CAPTIONCLOSE,CHECKED,Res)
  208.     DrawFrameControl(50,0,90,40,CAPTIONHELP,FLAT,Res)
  209.     DrawFrameControl(100,0,140,40,CAPTIONMAX,INACTIVE,Res)
  210.     DrawFrameControl(150,0,190,40,CAPTIONMIN,MONO,Res)
  211.     DrawFrameControl(200,0,240,40,CAPTIONRESTORE,PUSHED,Res)
  212.  
  213.     Goto Wait_for_Input
  214.  
  215. Control_Menu:
  216.     DrawStatusWinText(1,"Frame controls built into PiXCL.")
  217.     DrawBackground
  218.     DrawFrameControl(0,0,40,40,MENUARROW,CHECKED,Res)
  219.     DrawFrameControl(50,0,90,40,MENUBULLET,FLAT,Res)
  220.     DrawFrameControl(100,0,140,40,MENUCHECK,INACTIVE,Res)
  221.     DrawFrameControl(150,0,190,40,MENUARROW,MONO,Res)
  222.     DrawFrameControl(200,0,240,40,MENUARROW,PUSHED,Res)
  223.  
  224.     Goto Wait_for_Input
  225.  
  226. Control_Scroll:
  227.     DrawStatusWinText(1,"Frame controls built into PiXCL.")
  228.     DrawBackground
  229.     DrawFrameControl(0,0,40,40,SCROLLCOMBOBOX,CHECKED,Res)
  230.     DrawFrameControl(50,0,90,40,SCROLLDOWN,FLAT,Res)
  231.     DrawFrameControl(100,0,140,40,SCROLLLEFT,INACTIVE,Res)
  232.     DrawFrameControl(150,0,190,40,SCROLLRIGHT,MONO,Res)
  233.     DrawFrameControl(200,0,240,40,SCROLLSIZEGRIP,PUSHED,Res)
  234.     DrawFrameControl(250,0,290,40,SCROLLUP,PUSHED,Res)
  235.  
  236.     Goto Wait_for_Input
  237.  
  238.  
  239. Control_All:
  240.     DrawStatusWinText(1,"Frame controls built into PiXCL.")
  241.     DrawBackground
  242.     DrawFrameControl(0,0,40,40,BUTTONRADIO,INACTIVE,Res)
  243.     DrawFrameControl(50,0,90,40,BUTTONPUSH,INACTIVE,Res)
  244.     DrawFrameControl(100,0,140,40,BUTTON3STATE,INACTIVE,Res)
  245.     DrawFrameControl(150,0,190,40,BUTTONCHECK,INACTIVE,Res)
  246.  
  247.     DrawFrameControl(0,50,40,90,CAPTIONCLOSE,CHECKED,Res)
  248.     DrawFrameControl(50,50,90,90,CAPTIONHELP,FLAT,Res)
  249.     DrawFrameControl(100,50,140,90,CAPTIONMAX,INACTIVE,Res)
  250.     DrawFrameControl(150,50,190,90,CAPTIONMIN,MONO,Res)
  251.     DrawFrameControl(200,50,240,90,CAPTIONRESTORE,PUSHED,Res)
  252.  
  253.     DrawFrameControl(0,100,40,140,MENUARROW,CHECKED,Res)
  254.     DrawFrameControl(50,100,90,140,MENUBULLET,FLAT,Res)
  255.     DrawFrameControl(100,100,140,140,MENUCHECK,INACTIVE,Res)
  256.     DrawFrameControl(150,100,190,140,MENUARROW,MONO,Res)
  257.     DrawFrameControl(200,100,240,140,MENUARROW,PUSHED,Res)
  258.  
  259.     DrawFrameControl(0,150,40,190,SCROLLCOMBOBOX,CHECKED,Res)
  260.     DrawFrameControl(50,150,90,190,SCROLLDOWN,FLAT,Res)
  261.     DrawFrameControl(100,150,140,190,SCROLLLEFT,INACTIVE,Res)
  262.     DrawFrameControl(150,150,190,190,SCROLLRIGHT,MONO,Res)
  263.     DrawFrameControl(200,150,240,190,SCROLLSIZEGRIP,PUSHED,Res)
  264.     DrawFrameControl(250,150,290,190,SCROLLUP,PUSHED,Res)
  265.  
  266.     UseFont("Arial",6,17,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  267.     DrawText(200,5,"Button Controls")    
  268.     DrawText(250,55,"Caption Controls")    
  269.     DrawText(250,105,"Menu Controls")    
  270.     DrawText(300,155,"Scroll Controls")    
  271.  
  272.     Goto Wait_for_Input
  273.  
  274.  
  275. Captions:
  276.     DrawCaption("",10,  0,150, 30,  ICON,COLOR,INBUTTON,Res)
  277.     DrawCaption("",10, 30,150, 55,  ICON,COLOR,NOINBUTTON,Res)
  278.     DrawCaption("",10, 60,150, 85,NOICON,COLOR,NOINBUTTON,Res)
  279.     DrawCaption("",10, 90,150,115,NOICON,SMALLCAP,INBUTTON,Res)
  280.     DrawCaption("",10,120,150,145,NOICON,SMALLCAP,NOINBUTTON,Res)
  281.     
  282.     UseFont("Arial",6,17,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  283.     DrawText(155,5,"ICON,COLOR,INBUTTON")
  284.     DrawText(155,35,"ICON,COLOR,NOINBUTTON")
  285.     DrawText(155,65,"NOICON,COLOR,NOINBUTTON")
  286.     DrawText(155,95,"NOICON,SMALLCAP,INBUTTON")
  287.     DrawText(155,125,"NOICON,SMALLCAP,NOINBUTTON")
  288.  
  289.     Goto Wait_for_Input
  290.  
  291. GetHelp:
  292.     DrawStatusWinText(1,"Using the WinHelp command.")
  293.     HelpFile$ = SourceDir$ + "\pixclhlp.hlp"
  294.     WinHelp(HelpFile$,CONTENTS,"")
  295.     Goto Wait_for_Input
  296.  
  297. TestModulus:
  298.     DrawStatusWinText(1,"Getting a modulus number.")
  299.     DrawBackGround Flag = 0
  300.     DrawText(10,3,"Modulus 10 operations")
  301.     Random(1000,J)
  302.     DrawNumber(10,20, J)
  303.     K = J % 10   DrawNumber(10,45, K)
  304.     Negate(K)    DrawNumber(50,45, K)
  305.     Goto Wait_for_Input
  306.  
  307. RandNum:
  308.     DrawStatusWinText(1,"Generating random numbers")
  309.     DrawBackGround Flag = 0
  310.     Random(1000,Ran1) DrawNumber(10,10,Ran1)
  311.     Random(255,Ran2) DrawNumber(10,35,Ran2)
  312.     Goto Wait_for_Input
  313.  
  314. DrawBoxesR:
  315.     DrawStatusWinText(1,"Drawing random size and position boxes.")
  316.     If Flag = 0 Then DrawBackGround Flag = 1
  317.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  318.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  319.     DrawStatusWinText(0,"Click client area to stop")
  320. Loop1:
  321.     Random(cx2,X1) Random(cy2,Y1)
  322.     Random(128,Xsize) Random(128,Ysize)
  323.     Random(255,R) Random(255,G)  Random(255,B)
  324.     X2 = X1 + Xsize   Y2 = Y1 + Ysize
  325.     UsePen(SOLID,1,B,R,G)
  326.     UseBrush(SOLID,R,G,B)
  327.     DrawRectangle(X1,Y1,X2,Y2)
  328.     If FastDrawFlag = 0 Then WaitInput(1)
  329.     i = i + 1    j = i % 50
  330.     If j = 5 Then DrawStatusWinText(1,"Drawing random size and position boxes.")
  331.     If j = 0 
  332.         WaitInput(1) 
  333.         Str(i,i$)  i$ = i$ + " GDI draw operations"
  334.         DrawStatusWintext(1,i$)
  335.     Endif
  336.     Goto Loop1
  337.  
  338. DrawBoxesP:
  339.     DrawStatusWinText(1,"Drawing random size and position boxes.")
  340.     If Flag = 0 Then DrawBackGround Flag = 1
  341.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  342.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  343.     DrawStatusWinText(0,"Click client area to stop")
  344. Loop1a:
  345.     Random(cx2,X1) Random(cy2,Y1)
  346.     Random(128,Xsize) Random(128,Ysize)
  347.     Random(255,R) Random(255,G)  Random(255,B)
  348.     X2 = X1 + Xsize      Y2 = Y1
  349.     X3 = X1 + Xsize   Y3 = Y1 + Ysize
  350.     X4 = X1          Y4 = Y1 + Ysize
  351.     UsePen(SOLID,1,B,R,G)
  352.     UseBrush(SOLID,R,G,B)
  353.     DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4)
  354.     If FastDrawFlag = 0 Then WaitInput(1)
  355.     i = i + 1    j = i % 50
  356.     If j = 5 Then DrawStatusWinText(1,"Drawing random size and position boxes.")
  357.     If j = 0 
  358.         WaitInput(1) 
  359.         Str(i,i$)  i$ = i$ + " GDI draw operations"
  360.         DrawStatusWintext(1,i$)
  361.     Endif
  362.     Goto Loop1a
  363.  
  364.  
  365. DrawEllipses:
  366.     DrawStatusWinText(1,"Drawing random size and position ellipses.")
  367.     If Flag = 0 Then DrawBackGround Flag = 1
  368.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  369.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  370.     DrawStatusWinText(0,"Click client area to stop")
  371. Loop2:
  372.     Random(1000,X1) Random(768,Y1)
  373.     Random(128,Xsize) Random(192,Ysize)
  374.     Random(255,R) Random(255,G)  Random(255,B)
  375.     X2 = X1 + Xsize   Y2 = Y1 + Ysize
  376.     UsePen(SOLID,1,R,G,B)
  377.     UseBrush(SOLID,R,G,B)
  378.     DrawEllipse(X1,Y1,X2,Y2)
  379.     If FastDrawFlag = 0 Then WaitInput(1)
  380.     i = i + 1    j = i % 50
  381.     If j = 5 Then DrawStatusWinText(1,"Drawing random size and position ellipses.")
  382.     If j = 0 
  383.         WaitInput(1) 
  384.         Str(i,i$)  i$ = i$ + " polygons drawn"
  385.         DrawStatusWintext(1,i$)
  386.     Endif
  387.     Goto Loop2
  388.  
  389. DrawTriangles:
  390.     DrawStatusWinText(1,"Drawing random size and position triangles.")
  391.     If Flag = 0 Then DrawBackGround Flag = 1
  392.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  393.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  394.     DrawStatusWinText(0,"Click client area to stop")
  395. Loop2a:
  396.  
  397.     Random(cx2,X1) Random(cy2,Y1)
  398.     Random(cx2,X2) Random(cy2,Y2)
  399.     Random(cx2,X3) Random(cy2,Y3)
  400.     Random(255,R) Random(255,G)  Random(255,B)
  401.     UsePen(SOLID,1,R,G,B)
  402.     UseBrush(SOLID,G,B,R)
  403.     DrawTriangle(X1,Y1,X2,Y2,X3,Y3)
  404.     If FastDrawFlag = 0 Then WaitInput(1)
  405.     i = i + 1    j = i % 50
  406.     If j = 5 Then DrawStatusWinText(1,"Drawing random size and position triangles.")
  407.     If j = 0 
  408.         WaitInput(1) 
  409.         Str(i,i$)  i$ = i$ + "  triangles drawn"
  410.         DrawStatusWintext(1,i$)
  411.     Endif
  412.     Goto Loop2a
  413.  
  414.  
  415.  
  416. DrawImages:
  417.     DrawStatusWinText(1,"Drawing random size and position images.")
  418.     If Flag = 0 Then DrawBackGround Flag = 1
  419.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  420.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  421.     Image$ = SourceDir$ + "\1iddnext.bmp"
  422.     DrawStatusWinText(0,"Click client area to stop")
  423. Loop3:
  424.     Random(1000,X1) Random(768,Y1)
  425.     Random(500,Xsize) Random(340,Ysize)
  426.     X2 = X1 + Xsize   Y2 = Y1 + Ysize
  427.     
  428.     DrawSizedBitMap(X1,Y1,X2,Y2,Image$)
  429.     If FastDrawFlag = 0 Then WaitInput(1)
  430.     i = i + 1    j = i % 50
  431.     If j = 5 Then DrawStatusWinText(1,"Drawing random size and position images.")
  432.     If j = 0 
  433.         WaitInput(1) 
  434.         Str(i,i$)  i$ = i$ + " GDI draw operations"
  435.         DrawStatusWintext(1,i$)
  436.     Endif
  437.     Goto Loop3
  438.  
  439. DrawLines:
  440.     DrawStatusWinText(1,"Drawing random length and position lines.")
  441.     If Flag = 0 Then DrawBackGround Flag = 1
  442.     UsePen(SOLID,2,255,255,255)
  443.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  444.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  445.     DrawStatusWinText(0,"Click client area to stop")
  446.  
  447. Loop4:
  448.     Random(cx2,X1) Random(cy2,Y1)
  449.     Random(cx2,X2) Random(cy2,Y2)
  450.     Random(255,R) Random(255,G)  Random(255,B)
  451.     UsePen(SOLID,2,R,G,B)
  452.     
  453.     DrawLine(X1,Y1,X2,Y2)
  454.     If FastDrawFlag = 0 Then WaitInput(1)
  455.     i = i + 1    j = i % 50
  456.     If j = 5 Then DrawStatusWinText(1,"Drawing random length and position lines.")
  457.     If j = 0 
  458.         WaitInput(1) 
  459.         Str(i,i$)  i$ = i$ + " GDI draw operations"
  460.         DrawStatusWintext(1,i$)
  461.     Endif
  462.     Goto Loop4
  463.  
  464.  
  465. DrawLines2:
  466.     DrawStatusWinText(1,"Drawing bouncing lines.")
  467.     If Flag = 0 Then DrawBackGround Flag = 1
  468.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  469.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  470.     DrawStatusWinText(0,"Click client area to stop")
  471.     X1 = 100  Y1 = 100
  472.     X2 = X1 + 128  Y2 = Y1 + 128
  473.     IncrX1 = 1  IncrY1 = 2
  474.     IncrX2 = 4  IncrY2 = 6
  475.     Random(255,R) Random(255,G)  Random(255,B)
  476.     UsePen(SOLID,1,R,G,B)
  477.     ColorFlag = 0
  478. Loop5:
  479.     k = i % 1000
  480.     DrawLine(X1,Y1,X2,Y2)
  481.     If FastDrawFlag = 0 Then WaitInput(1)
  482.     X1 = X1 + IncrX1  Y1 = Y1 + IncrY1
  483.     X2 = X2 + IncrX2  Y2 = Y2 + IncrY2
  484.  
  485.     If X1 <= cx1 Then Negate(IncrX1)  ColorFlag = 1
  486.     If X1 >= cx2 Then Negate(IncrX1) 
  487.     If X2 >= cx2 Then Negate(IncrX2)  ColorFlag = 1
  488.     If X2 <= cx1 Then Negate(IncrX2) 
  489.     If Y2 >= cy2 Then Negate(IncrY2)  ColorFlag = 1
  490.     If Y2 <= cy1 Then Negate(IncrY2) 
  491.     If Y1 <= cy1 Then Negate(IncrY1)  ColorFlag = 1
  492.     If Y1 >= cy2 Then Negate(IncrY1) 
  493. {
  494.     R = R + 5  If R >= 255 Then R = 0
  495.     G = G + 5  If G >= 255 Then G = 0
  496.     B = B + 5  If B >= 255 Then B = 0
  497. }
  498.     If  ColorFlag = 1
  499.         Random(255,R) Random(255,G)  Random(255,B)
  500.         UsePen(SOLID,1,R,G,B)
  501.         ColorFlag = 0
  502.     Endif
  503.     i = i + 1    j = i % 50
  504.     If j = 5 Then DrawStatusWinText(1,"Drawing bouncing lines.")
  505.     If j = 0 
  506.         WaitInput(1) 
  507.         Str(i,i$)  i$ = i$ + " GDI draw operations"
  508.         DrawStatusWintext(1,i$)
  509.     Endif
  510.     Goto Loop5
  511.  
  512.  
  513.  
  514.  
  515.  
  516. DrawBounce:
  517.     DrawStatusWinText(1,"Drawing bouncing boxes and ellipses.")
  518.     If Flag = 0 Then DrawBackGround Flag = 1
  519.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  520.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  521.     DrawStatusWinText(0,"Click client area to stop")
  522.     Random(cx2,X1) Random(cy2,Y1)
  523.     X2 = X1 + 48  Y2 = Y1 + 48
  524.     IncrX = 12  IncrY = 12
  525.     Random(255,R) Random(255,G)  Random(255,B)
  526.     UsePen(SOLID,2,R,G,B)
  527.     UseBrush(SOLID,B,R,G)
  528.     ColorFlag = 0
  529. Loop6:
  530.     k = i % 1000
  531.     If k <= 500 Then DrawEllipse(X1,Y1,X2,Y2)
  532.     If k > 500 Then DrawRectangle(X1,Y1,X2,Y2)
  533.     If FastDrawFlag = 0 Then WaitInput(1)
  534.     X1 = X1 + IncrX  Y1 = Y1 + IncrY
  535.     X2 = X1 + 48  Y2 = Y1 + 48
  536.     If X2 > cx2 Then Negate(IncrX) ColorFlag = 1
  537.     If X1 < cx1 Then Negate(IncrX) ColorFlag = 1
  538.     If Y2 > cy2 Then Negate(IncrY) ColorFlag = 1
  539.     If Y1 < cy1 Then Negate(IncrY) ColorFlag = 1
  540.     R = R + 5  If R >= 255 Then R = 0
  541.     G = G + 5  If G >= 255 Then G = 0
  542.     B = B + 5  If B >= 255 Then B = 0
  543.     UseBrush(SOLID,R,G,B)
  544.     If  ColorFlag = 1
  545.         Random(255,R) Random(255,G)  Random(255,B)
  546.         UsePen(SOLID,1,B,R,G)
  547.         UseBrush(SOLID,R,G,B)
  548.         ColorFlag = 0
  549.     Endif
  550.     i = i + 1    j = i % 50
  551.     If j = 5 Then DrawStatusWinText(1,"Drawing bouncing boxes and ellipses.")
  552.     If j = 0 
  553.         WaitInput(1) 
  554.         Str(i,i$)  i$ = i$ + " GDI draw operations"
  555.         DrawStatusWintext(1,i$)
  556.     Endif
  557.     Goto Loop6
  558.  
  559.  
  560. DrawPolygons:
  561.     DrawStatusWinText(1,"Drawing random 9 vertex polygons.")
  562.     If Flag = 0 Then DrawBackGround Flag = 1
  563.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  564.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  565.     DrawStatusWinText(0,"Click client area to stop")
  566. Loop7:
  567.     Random(cx2,X1) Random(cy2,Y1)
  568.     Random(cx2,X2) Random(cy2,Y2)
  569.     Random(cx2,X3) Random(cy2,Y3)
  570.     Random(cx2,X4) Random(cy2,Y4)
  571.     Random(cx2,X5) Random(cy2,Y5)
  572.     Random(cx2,X6) Random(cy2,Y6)
  573.     Random(cx2,X7) Random(cy2,Y7)
  574.     Random(cx2,X8) Random(cy2,Y8)
  575.     Random(cx2,X9) Random(cy2,Y9)
  576.     Random(255,R) Random(255,G)  Random(255,B)
  577.     UsePen(SOLID,1,R,G,B)
  578.     UseBrush(SOLID,G,B,R)
  579.     DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,X7,Y7,X8,Y8,X9,Y9)
  580.     If FastDrawFlag = 0 Then WaitInput(1)
  581.     i = i + 1    j = i % 50
  582.     If j = 5 Then DrawStatusWinText(1,"Drawing random 9 vertex polygons.")
  583.     If j = 0 
  584.         WaitInput(1) 
  585.         Str(i,i$)  i$ = i$ + "  polygons drawn"
  586.         DrawStatusWintext(1,i$)
  587.     Endif
  588.     Goto Loop7
  589.  
  590. DrawStars:
  591.     DrawStatusWinText(1,"Drawing bouncing five point stars.")
  592.     If Flag = 0 Then DrawBackGround Flag = 1
  593.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  594.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  595.     DrawStatusWinText(0,"Click client area to stop")
  596.     Random(cx2,ctX1) Random(cy2,ctY1)
  597.     IncrX = 12  IncrY = 12
  598.     Random(255,R) Random(255,G)  Random(255,B)
  599.     UsePen(SOLID,1,R,G,B)
  600.     UseBrush(SOLID,B,R,G)
  601.     ColorFlag = 0
  602.     GoSub UpDateStarCoords
  603.     DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5)
  604.  
  605. Loop8:
  606.     GoSub UpDateStarCoords
  607.     DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5)
  608.     If FastDrawFlag = 0 Then WaitInput(1)
  609.     ctX1 = ctX1 + IncrX  ctY1 = ctY1 + IncrY
  610.     If ctX1 < cx1 Then Negate(IncrX) ColorFlag = 1
  611.     If ctY1 < cy1 Then Negate(IncrY) ColorFlag = 1
  612.     If ctX1 > cx2 Then Negate(IncrX) ColorFlag = 1
  613.     If ctY1 > cy2 Then Negate(IncrY) ColorFlag = 1
  614.     R = R + 5  If R >= 255 Then R = 0
  615.     G = G + 5  If G >= 255 Then G = 0
  616.     B = B + 5  If B >= 255 Then B = 0
  617.     UseBrush(SOLID,R,G,B)
  618.     If  ColorFlag = 1
  619.         Random(255,R) Random(255,G)  Random(255,B)
  620.         UsePen(SOLID,1,B,R,G)
  621.         UseBrush(SOLID,R,G,B)
  622.         ColorFlag = 0
  623.     Endif
  624.     i = i + 1    j = i % 50
  625.     If j = 5 Then DrawStatusWinText(1,"Drawing bouncing five point stars.")
  626.     If j = 0 
  627.         WaitInput(1) 
  628.         Str(i,i$)  i$ = i$ + "  polygons drawn"
  629.         DrawStatusWintext(1,i$)
  630.     Endif
  631.     Goto Loop8
  632.  
  633. DrawMapleLeaf1:
  634.     DrawStatusWinText(1,"Maple leaves ... hey, we're Canadian !")
  635.     If Flag = 0 Then DrawBackGround Flag = 1
  636.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  637.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  638.     DrawStatusWinText(0,"Click client area to stop")
  639.     Random(cx2,ctX1) Random(cy2,ctY1)
  640.     IncrX = 12  IncrY = 12
  641.     {Random(255,R) Random(255,G)  Random(255,B)}
  642.     R = 255  G = 60  B = 60
  643.     UsePen(SOLID,1,B,R,G)
  644.     UseBrush(SOLID,R,G,B)
  645.     ColorFlag = 0
  646.     GoSub UpDateMapleLeafCoords
  647.     DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,
  648.             X7,Y7,X8,Y8,X9,Y9,X10,Y10,X11,Y11,
  649.             X12,Y12,X13,Y13,X14,Y14,X15,Y15,
  650.             X16,Y16,X17,Y17,X18,Y18,X19,Y19)
  651.  
  652. Loop9:
  653.     ctX1 = ctX1 + IncrX  ctY1 = ctY1 + IncrY
  654.     If ctX1 < cx1 Then Negate(IncrX) ColorFlag = 1
  655.     If ctY1 < cy1 Then Negate(IncrY) ColorFlag = 1
  656.     If ctX1 > cx2 Then Negate(IncrX) ColorFlag = 1
  657.     If ctY1 > cy2 Then Negate(IncrY) ColorFlag = 1
  658.     GoSub UpDateMapleLeafCoords
  659.     DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,
  660.             X7,Y7,X8,Y8,X9,Y9,X10,Y10,X11,Y11,
  661.             X12,Y12,X13,Y13,X14,Y14,X15,Y15,
  662.             X16,Y16,X17,Y17,X18,Y18,X19,Y19)
  663.     If FastDrawFlag = 0 Then WaitInput(1)
  664.     R = R - 3  If R < 0 Then R = 255
  665.     G = G - 3  If G < 0 Then G = 255
  666.     B = B - 3  If B < 0 Then B = 255
  667.     UseBrush(SOLID,R,G,B)
  668.     UsePen(SOLID,1,B,R,G)
  669.     If  ColorFlag = 1
  670.         Random(255,R) Random(255,G)  Random(255,B)
  671.         UsePen(SOLID,1,B,R,G)
  672.         UseBrush(SOLID,R,G,B)
  673.         ColorFlag = 0
  674.     Endif
  675.  
  676.     i = i + 1    j = i % 50
  677.     If j = 0 
  678.         WaitInput(1) 
  679.         Str(i,i$)  i$ = i$ + "  polygons drawn"
  680.         DrawStatusWintext(1,i$)
  681.     Endif
  682.     If j = 15 Then WaitInput(1) DrawStatusWinText(1,"Maple leaf has 19 vertices.")
  683.     If j = 42 Then WaitInput(1) DrawStatusWinText(1,"Maple leaves ? Hey, we're Canadian !")
  684.     Goto Loop9
  685.  
  686.  
  687.  
  688. DrawMapleLeaf2:
  689.     DrawStatusWinText(1,"Maple leaves ... hey, we're Canadian !")
  690.     If Flag = 0 Then DrawBackGround Flag = 1
  691.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  692.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  693.     DrawStatusWinText(0,"Click client area to stop")
  694.     Random(cx2,ctX1) Random(cy2,ctY1)
  695.     R = 200  G = 110  B = 60
  696.     UsePen(SOLID,1,B,R,G)
  697.     UseBrush(SOLID,R,G,B)
  698.  
  699. Loop10:
  700.     GoSub UpDateMapleLeafCoords
  701.     DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,
  702.             X7,Y7,X8,Y8,X9,Y9,X10,Y10,X11,Y11,
  703.             X12,Y12,X13,Y13,X14,Y14,X15,Y15,
  704.             X16,Y16,X17,Y17,X18,Y18,X19,Y19)
  705.     If FastDrawFlag = 0 Then WaitInput(1)
  706.     R = R + 3  If R > 255 Then Random(255,R)
  707.     G = G + 3  If G > 255 Then Random(255,G)
  708.     B = B + 3  If B > 255 Then Random(255,B)
  709.     UseBrush(SOLID,R,G,B)
  710.     UsePen(SOLID,1,B,R,G)
  711.  
  712.     i = i + 1    j = i % 50
  713.     If j = 0 
  714.         WaitInput(1) 
  715.         Str(i,i$)  i$ = i$ + "  polygons drawn"
  716.         DrawStatusWintext(1,i$)
  717.     Endif
  718.     If j = 15 Then WaitInput(1) DrawStatusWinText(1,"Maple leaf has 19 vertices.")
  719.     If j = 42 Then WaitInput(1) DrawStatusWinText(1,"Maple leaves ? Hey, we're Canadian !")
  720.     Random(cx2,ctX1) Random(cy2,ctY1)
  721.     Goto Loop10
  722.  
  723.  
  724.  
  725. StopDraw:
  726.     DrawBackGround
  727.     DrawNumber(10,10,i)
  728.     Goto Wait_for_Input
  729.  
  730. UpDateMapleLeafCoords: {subroutine}
  731.     X1 = ctX1 + 2     Y1 = ctY1 + 25
  732.     X2 = ctX1 + 2    Y2 = ctY1
  733.     X3 = ctX1 + 40   Y3 = ctY1 + 10
  734.     X4 = ctX1 + 28   Y4 = ctY1 - 5
  735.     X5 = ctX1 + 50   Y5 = ctY1 - 45
  736.     X6 = ctX1 + 31      Y6 = ctY1 - 38
  737.     X7 = ctX1 + 30   Y7 = ctY1 - 58
  738.     X8 = ctX1 + 18      Y8 = ctY1 - 34
  739.     X9 = ctX1 + 18      Y9 = ctY1 - 68
  740.     X10 = ctX1       Y10 = ctY1 - 52
  741.     X11 = ctX1 - 18     Y11 = ctY1 - 68
  742.     X12 = ctX1 - 18  Y12 = ctY1 - 34
  743.     X13 = ctX1 - 30  Y13 = ctY1 - 58
  744.     X14 = ctX1 - 31  Y14 = ctY1 - 38
  745.     X15 = ctX1 - 50  Y15 = ctY1 - 45
  746.     X16 = ctX1 - 28  Y16 = ctY1 - 5
  747.     X17 = ctX1 - 40  Y17 = ctY1 + 10
  748.     X18 = ctX1 - 2   Y18 = ctY1
  749.     X19 = ctX1 - 2   Y19 = ctY1 + 25
  750.     Return
  751.  
  752. UpDateStarCoords: {subroutine}
  753.     X1 = ctX1      Y1 = ctY1 - 60
  754.     X2 = ctX1 + 36  Y2 = ctY1 + 45
  755.     X3 = ctX1 - 54  Y3 = ctY1 - 30
  756.     X4 = ctX1 + 54  Y4 = ctY1 - 30
  757.     X5 = ctX1 - 36  Y5 = ctY1 + 45
  758.     Return
  759.